﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Framework.Specifications;
using Domain.Module.Entities;

namespace Domain.Specification.Users
{
    public class UserNameSpecification
         : Specification<User>
    {

        #region Members

        string _userName = default(String);

        #endregion

        #region Constructor

        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="countryName">User name that result match</param>
        public UserNameSpecification(string userName)
        {
            _userName = userName;
        }
        #endregion

        #region Specification<User> Members


       

        public override System.Linq.Expressions.Expression<Func<User, bool>> GetExpression()
        {
            return (user => string.IsNullOrEmpty(_userName) || user.Name.Equals(_userName));
        } 
        
        #endregion
    }
}
